package com.lhsy.djcloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lhsy.djcloud.entity.Employee;
import com.lhsy.djcloud.mapper.EmployeeMapper;
import com.lhsy.djcloud.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangzw
 * @since 2020-09-14
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {
    @Autowired private EmployeeMapper employeeMapper;
    @Override
    public List<Employee> selectByDeptId(Integer deptId) {
        QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
        Employee employee = new Employee();
        employee.setDeptId(deptId);
        queryWrapper.setEntity(employee);
        return employeeMapper.selectList(queryWrapper);
    }

    @Override
    public List<Employee> selectByDeptIds(List<Integer> deptIds) {
        return employeeMapper.selectByDeptIds(deptIds);
    }

    @Override
    public List<Employee> selectByTenantId(Integer tenantId) {
        QueryWrapper<Employee> queryWrapper = new QueryWrapper<>();
        Employee employee = new Employee();
        employee.setTenantId(tenantId);
        queryWrapper.setEntity(employee);
        return employeeMapper.selectList(queryWrapper);
    }

    @Override
    public int delete(Integer id) {
        return employeeMapper.deleteById(id);
    }

    @Override
    public List<Employee> selectByIds(List<Integer> employeeIds) {
        return employeeMapper.selectByIds(employeeIds);
    }

    @Override
    public List<Employee> selectByDeptIdAndSearch(Integer deptId, String params) {
        return employeeMapper.selectByDeptIdAndSearch(deptId,params);
    }

    @Override
    public List<Employee> selectByDeptIdsAndSearch(List<Integer> depts, String params) {
        return employeeMapper.selectByDeptIdsAndSearch(depts,params);
    }

    @Override
    public List<Employee> selectByTenantIdAndSearch(Integer tenantId, Integer deptId,String params) {
        return employeeMapper.selectByTenantIdAndSearch(tenantId,deptId,params);
    }
}
